﻿using Abp.Application.Services;
using Abp.Domain.Repositories;
using Abp.Linq.Extensions;
using AbpVueDemo.Contract_Management.OwnerContractManagement.OwnerContractManagementDto;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AbpVueDemo.Contract_Management.OwnerContractManagement
{
    //货主合同
   public class OwnerContractService : AsyncCrudAppService<OwnerContractManagementPo, OwnerContractInputDto, int, PageOwnerContractRequestDto, OwnerContractCteateDto, OwnerContractUpdateDto>, IOwnerContractService
    {

        public OwnerContractService(IRepository<OwnerContractManagementPo, int> repository) : base(repository)
        {
        }
       protected override IQueryable<OwnerContractManagementPo> CreateFilteredQuery(PageOwnerContractRequestDto input)
       {
           return base.CreateFilteredQuery(input)
               .WhereIf(!string.IsNullOrEmpty(input.o_c_name), c => c.o_c_name.Contains(input.o_c_name)).WhereIf(!string.IsNullOrEmpty(input.o_unit), c => c.o_unit.Contains(input.o_unit)).WhereIf(!string.IsNullOrEmpty(input.o_principal), c => c.o_principal.Contains(input.o_principal)).WhereIf(!string.IsNullOrEmpty(input.o_chartered), c => c.o_chartered.Contains(input.o_chartered)).WhereIf(!string.IsNullOrEmpty(input.o_c_status), c => c.o_c_status.Contains(input.o_c_status));

       }

        //批删
        public async Task<bool> DeleteAll(List<int> ids)
        {
            Repository.Delete(c => ids.Contains(c.Id));
            return true;
        }
    }
}
